/*
 * 说明：使用QSS修饰按钮控件演示程序。
*/

#include <QApplication>
#include <QFile>
#include <QPushButton>
#include <QMainWindow>
#include "propertytest.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    propertytest pt;
    pt.setProperty("color", QColor(100, 100, 100));


    QMainWindow mw;
    mw.setObjectName("MW");
    mw.resize(200, 200);
    mw.setStyleSheet("QMainWindow#MW{background-color: rgb(0, 0, 0)}");

    QPushButton* btn1 = new QPushButton(&mw);
    btn1->resize(32, 32);
    btn1->move(50, 50);
    //btn1->setStyleSheet("background-color: rgb(255, 0, 0)");

    QPushButton* btn = new QPushButton(&mw);
    btn->setObjectName("btn_Test");
    btn->resize(32, 32);
    btn->setCheckable(true);
//    btn->show();

    QFile styleSheet(":/test.qss");
    if (!styleSheet.open(QIODevice::ReadOnly))
    {
        qWarning("Can't open the style sheet file.");
        return 0;
    }
    btn->setStyleSheet(styleSheet.readAll());

    //btn->show();

    mw.show();
    return a.exec();
}
